<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style>
	body{height:auto;font-family: "Microsoft YaHei";}
	button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
</style>
<body class="hold-transition box box-main">
	<!--<div class="treeSearchInput" id="search">-->
		<!--<label for="keyword">关键字：</label><input type="text" class="empty" id="keyword" maxlength="50">-->
		<!--<button class="btn" id="btn" onclick="searchNode()"> 搜索 </button>-->
	<!--</div>-->
	<!--<div class="col-sm-12 select-info table-striped">-->
		<!--<table id="bootstrap-table" data-mobile-responsive="true"></table>-->
	<!--</div>-->

	<div class="container-div">
		<input id="chooseId"   name="chooseId"    type="hidden"/>
		<input id="chooseName" name="chooseName"  type="hidden"/>
		<div class="row">
			<!--<div class="btn-group hidden-xs" id="toolbar" role="group">-->
				<!--<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="system:role:add">-->
					<!--<i class="fa fa-plus"></i> 新增-->
				<!--</a>-->
				<!--<a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.removeAll()" shiro:hasPermission="system:role:remove">-->
					<!--<i class="fa fa-trash-o"></i> 删除-->
				<!--</a>-->
			<!--</div>-->
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>

<div class="layui-layer-btn">
	<a class="layui-layer-btn0" onclick="loadObj()"><i class="fa fa-check"></i> 确定</a>
	<a class="layui-layer-btn1" onclick="$.modal.close()"><i class="fa fa-close"></i> 关闭</a>
</div>
<div th:include="include::footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "system/user"
    $(function() {
        // loadTree();
        queryUserList();
    });

    function queryUserList() {
        var options = {
            url: prefix + "/query",
            sortName: "createTime",
            sortOrder: "desc",
            modalName: "用户",
            // addHeight:720,
            //editHeight:680,
            search: true,
            showExport: false,// 是否支持导出文件
            showRefresh:false,// 是否显示刷新按钮
            showColumns :false,// 是否显示隐藏某列下拉框
            showToggle:false,// 是否显示详细视图和列表视图的切换按钮
            columns: [{
                radio: true
            },{
                field: 'userId',
                title: '序号',
                align: 'center',
                width:'100'
            },
                {
                    field: 'userName',
                    title: '名称',
                    align: 'center',
					width:'200px'
                }
                // {
                //     field: 'dept.deptName',
                //     title: '部门'
                // },
                // {
                //     field: 'email',
                //     title: '邮箱',
                //     visible: true
                // },
                // {
                //     field: 'phoneNumber',
                //     title: '手机'
                // }
                ]
        };
        $.table.init(options);
    }

    function loadObj(){
        var rowId =$.table.selectFirstColumns();
        var rowName = $.map($('#bootstrap-table').bootstrapTable('getSelections'), function (row) {
            return row[$.table._option.columns[2].field];
        });

        debugger;
        if (rowId.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        parent.$("#chooseId").val(rowId.join());
        parent.$("#chooseName").val(rowName.join());
        var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
        parent.layer.close(index);
    }
</script>
</body>
</html>
